{template modoer_header}

<div id="body">
    <div class="myhead"></div>
    <div class="mymiddle">
        <div class="myleft">
            <!--{template 'menu','member',MOD_FLAG}-->
        </div>
        <div class="myright">
            <div class="myright_top"></div>
            <div class="myright_middle">
                <h3>我的积分</h3>
				<div class="mainrail">
                    <ul class="optabs"><li><a href="{url member/index/ac/$ac}">积分兑换</a></li><li class="active"><a href="{url member/index/ac/$ac/op/log}">积分记录</a></li></ul><div class="clear"></div>
					<table width="100%" cellspacing="0" cellpadding="0" class="maintable" trmouse="Y">
						<tr class="thbg">
							<th width="110">时间</th>
                            <th width="60">积分类型</th>
                            <th width="60">收入</th>
                            <th width="60">支出</th>
							<th width="75">余额</th>
							<th width="*">说明</th>
						</tr>
						<!--{dbres $list $val}-->
						<tr>
							<td>{date $val[dateline]}</td>
                            <td style="color:{if $val[point_flow]=='in'}green{else}red{/if};">{print:member point(point/$val[point_type])}</td>
							<td style="color:green;">{if $val[point_flow]=='in'}+{print get_numeric($val[point_value])}{/if}</td>
							<td style="color:red;">{if $val[point_flow]=='out'}-{print get_numeric($val[point_value])}{/if}</td>
                            <td>{if $val[amount]}{print get_numeric($val[amount])}{else}N/A{/if}</td>
							<td style="color:#808080;">$val[remark]</td>
						</tr>
						<!--{/dbres}-->
					</table>
                    <div class="multipage">$multipage</div>
				</div>
            </div>
        </div>
        <div class="clear"></div>
    </div>
    <div class="mybottom"></div>
</div>
<script type="text/javascript">
function calc_rate() {
	var invalue = $('#in_value').val();
	if(!is_numeric(invalue) || invalue < 1) { $('#out_value').val(0); return; }
	var inpoint = $('#in_point option:selected');
	var in_rate = inpoint.attr('rate');

	var outpoint = $('#out_point option:selected');
	var out_rate = outpoint.attr('rate');

	var needpoint = Math.ceil(in_rate / out_rate * invalue);
	$('#out_value').val(needpoint);
}

function toInt(input) {
    var s = parseInt(input);
    return isNaN(s) ? 0 : s;
}

function exchange_submit() {
    var inpoint = $('#in_point option:selected');
    var outpoint = $('#out_point option:selected');
    if(inpoint.text() == outpoint.text()) { alert('请选择不同的积分类型进行兑换。'); return false; }
    var mypoint = $('#my_' + outpoint.attr('value')).text();
    var outpoint_ex = parseInt($('#out_value').val());
    if(mypoint < outpoint_ex) { 
        alert('对不起，您兑换的积分不足。'); 
        return false;
    }
    return confirm('您确定进行本次兑换吗?');
}
jQuery(document).ready(function($) {
    calc_rate();
});
</script>
<!--{eval footer();}-->